package com.yoga.manager.beanUtil;

import com.yoga.common.bo.AboutClassRecordBO;
import com.yoga.dao.domain.AboutClassRecordDO;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 类AboutClassRecordBeanUtil.java的实现描述：工具类
 * 
 * @Author hdx
 * @Date 2020年09月24日
 */
public class AboutClassRecordBeanUtil {

    private AboutClassRecordBeanUtil(){
    }

    public static AboutClassRecordDO aboutClassRecordBOToDO(AboutClassRecordBO srcObj) {
        if (srcObj == null) {
            return null;
        }
        AboutClassRecordDO targetObj = new AboutClassRecordDO();
        targetObj.setId(srcObj.getAboutClassRecordId());//id
        targetObj.setClassTableId(srcObj.getClassTableId());//课程表id
        targetObj.setYogaUserId(srcObj.getYogaUserId());//会员id
        targetObj.setRecordStatus(srcObj.getRecordStatus());//约课状态：0、已约课，1、已签到，2、取消预约
        targetObj.setAboutDate(srcObj.getAboutDate());//约课日期
        targetObj.setDeleteMark(srcObj.getDeleteMark());//0、正常，1、已删除
        targetObj.setCreateTime(srcObj.getCreateTime());
        targetObj.setUpdateTime(srcObj.getUpdateTime());
        return targetObj;
    }

    public static AboutClassRecordBO aboutClassRecordDOToBO(AboutClassRecordDO srcObj) {
        if (srcObj == null) {
            return null;
        }
        AboutClassRecordBO targetObj = new AboutClassRecordBO();
        targetObj.setAboutClassRecordId(srcObj.getId());//id
        targetObj.setClassTableId(srcObj.getClassTableId());//课程表id
        targetObj.setYogaUserId(srcObj.getYogaUserId());//会员id
        targetObj.setRecordStatus(srcObj.getRecordStatus());//约课状态：0、已约课，1、已签到，2、取消预约
        targetObj.setAboutDate(srcObj.getAboutDate());//约课日期
        targetObj.setDeleteMark(srcObj.getDeleteMark());//0、正常，1、已删除
        targetObj.setCreateTime(srcObj.getCreateTime());
        targetObj.setUpdateTime(srcObj.getUpdateTime());
        return targetObj;
    }

    public static List<AboutClassRecordBO> doList2BOList(List<AboutClassRecordDO> doList) {
        List<AboutClassRecordBO> boList = new ArrayList<>();
        if (CollectionUtils.isEmpty(doList)) {
            return boList;
        }
        doList.stream().forEach(aboutClassRecordDO -> boList.add(AboutClassRecordBeanUtil.aboutClassRecordDOToBO(aboutClassRecordDO)));
        return boList;
    }
}